package com.woniuxy.intellihome.controller.ucenter;


import com.woniuxy.intellihome.entity.User;
import com.woniuxy.intellihome.service.UserService;
import com.woniuxy.intellihome.service.VCreditService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @author ganrun 2021-8-16  添加user
 * @since 2021-08-11
 */
@Slf4j
@Controller
@RequestMapping("ucenter/credit")
public class CreditController {
    @Autowired
    private VCreditService vCreditService;
    @Autowired
    private UserService userService;
    @GetMapping("list")
     public String credit(HttpSession session, Model model){
        User user = (User) session.getAttribute("user1");
        model.addAttribute("user",userService.getById(user.getId()));
        model.addAttribute("vCreditList",vCreditService.getByUserId(user.getId()));
        log.debug("vCreditList:",vCreditService.getByUserId(user.getId()));
        return "ucenter/user_integral";
     }
}

